const hotEmitter = require("../../webpack/hot/emitter");
var socket = io();
var currentHash = "";
var initial = true;

socket.on("hash", (hash) => {
  currentHash = hash;
});

socket.on("ok", () => {
  console.log("ok");
  if (initial) {
    return (initial = false);
  }
  reloadApp();
});

function reloadApp() {
  hotEmitter.emit("webpackHotUpdate", currentHash);
}
